import {request} from "../../request/index"
Page({
  data: {
    PageCur: 'basics',
    swiperList: [],
    catitemsList:[],
    floorData:[],
  },
  NavChange(e) {
    this.setData({
      PageCur: e.currentTarget.dataset.cur
    })
  },
  onShareAppMessage() {
    return {
      title: 'ColorUI-高颜值的小程序UI组件库',
      imageUrl: '/images/share.jpg',
      path: '/pages/index/index'
    }
  },
  onLoad(){
    this.getSwiperList();
    this.getCatitems();
    this.getFloorData();
  },
  getSwiperList(){
    request({
        url:'/home/swiperdata'
    }).then(res=>{
      console.log(res);
        this.setData({
          swiperList:res
        })
    },e=>{
      console.log(e);
    })
  },
  async getCatitems(){
    const data = await request({url:'/home/catitems'});
    console.log(data);
    this.setData({
      catitemsList:data
    })
  },
  async getFloorData(){
    const data = await request({url:"/home/floordata"});
    this.setData({
      floorData:data
    })
    console.log(data);
  },
})